import path from "path"
import resret from "../../commonPort/resret"
import {readFlie,writeFlie} from "../../../../fs_file包封装/node_modules/fs_file"
export default function remove(req,res) { //删除
    let {callback,id} =  req.query
    // let {
    //     id
    // } = JSON.parse(req.buf)
    var arr = JSON.parse(readFlie(path.join(__dirname, "../json/json.json")))
    arr.forEach((item, i) => {
        item.list.forEach((key, j) => {
            if (key["id"] === id) {
                arr[i].list[j] = {}
                writeFlie(path.join(__dirname, "../json/json.json"), JSON.stringify(arr))
                resret({
                    res,
                    callback,
                    text: JSON.stringify(arr)
                })

            }
        })

    });
    return true;
}